package StudyCode.summary.zipfile;

import java.util.zip.GZIPInputStream;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class IsGZipped {
	public static boolean isGZipped(byte[] data) {
		if (data == null || data.length < 2) {
			return false;
		}

		int head = ((int) data[0] & 0xff) | ((data[1] << 8) & 0xff00);
		return (GZIPInputStream.GZIP_MAGIC == head);
	}
}
